package com.sskj.gocoinapp;

import android.content.Context;
import android.support.multidex.MultiDexApplication;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.launcher.ARouter;
import com.shizhefei.view.coolrefreshview.CoolRefreshView;
import com.shizhefei.view.coolrefreshview.IPullHeaderFactory;
import com.shizhefei.view.coolrefreshview.PullHeader;
import com.shizhefei.view.coolrefreshview.header.MaterialHeader;
import com.sskj.common.router.service.CommonService;
import com.sskj.gocoin.route.service.MineFabiService;
import com.sskj.gocoinapp.ui.activity.MainActivity;
import com.sskj.lib.router.service.LibService;
import com.tencent.bugly.crashreport.CrashReport;
import com.zxy.recovery.core.Recovery;

import es.dmoral.toasty.Toasty;

/**
 * 作者 :吕志豪
 * 简书：https://www.jianshu.com/u/6e525b929aac
 * github：https://github.com/lvzhihao100
 * 描述：
 * 创建时间：2018-10-18 08:52
 */
public class BaseApplication extends MultiDexApplication {
    @Autowired
    CommonService commonService;
    @Autowired
    LibService libService;
    @Autowired
    MineFabiService mineFabiService;

    @Override
    public void onCreate() {
        super.onCreate();
//        ARouter.openLog();
        ARouter.openDebug();
        ARouter.init(this);
        ARouter.getInstance().inject(this);
//        Recovery.getInstance()
//                .debug(true)
//                .recoverInBackground(false)
//                .recoverStack(true)
//                .mainPage(MainActivity.class)
//                .recoverEnabled(true)
//                .callback(null)
//                .silent(false, Recovery.SilentMode.RECOVER_ACTIVITY_STACK)
//                .init(this);
        CrashReport.initCrashReport(this, "35071cfde0", false);
        CoolRefreshView.setPullHeaderFactory(new IPullHeaderFactory() {
            @Override
            public PullHeader made(Context context) {
                MaterialHeader commonHeader = new MaterialHeader(context);
                return commonHeader;

            }

            @Override
            public boolean isPinContent() {
                return true;
            }
        });

        Toasty.Config.getInstance()
                .apply(); // required
    }
}
